﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VirtualPress.Infrastructure.Entities.Repository;
using VirtualPress.Infrastructure.Entities.Enum;

namespace VirtualPress.Infrastructure.Entities.Entity
{
    public class ArticleAuthor : IAccessible<T_ArticleAuthor, ArticleAuthor>, ILogicEntity<T_ArticleAuthor, ArticleAuthor>
    {
        #region Fileds 
        public int Id { get; set; }
        public int ManuscriptId { get; set; }
        public int AuthorId { get; set; }
        public string AuthorName { get; set; }
        #endregion

        protected override void Covariant(T_ArticleAuthor model)
        {
            if (model != null)
            {
                this.Id = model.Id;
                this.ManuscriptId = model.ManuscriptId;
                this.AuthorId = model.AuthorId;
                this.AuthorName = model.AuthorName;
            }
        }

        protected override T_ArticleAuthor Inverter(ArticleAuthor model)
        {
            if (model != null)
            {
                return new T_ArticleAuthor()
                {
                    AuthorId = model.AuthorId,
                    AuthorName = model.AuthorName,
                    Id = model.Id,
                    ManuscriptId = model.ManuscriptId
                };
            }
            return null;
        }

        public ArticleAuthor Set(T_ArticleAuthor dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
